package com.haredot.mapper;

import com.haredot.entity.Btn;
import org.apache.ibatis.annotations.Mapper;
import org.springframework.cache.annotation.CacheEvict;
import org.springframework.cache.annotation.Cacheable;

import java.util.List;

@Mapper
public interface BtnMapper {

    @Cacheable(value = "btn:find", key = "#a0")
    List<Btn> findBtnsByFuncId(Long funcId);

    @CacheEvict(value = "btn:find", allEntries = true)
    int insert(Btn btn);

    @CacheEvict(value = "btn:find", allEntries = true)
    int update(Btn btn);

    @Cacheable(value = "btn:find", key = "#a0")
    Btn findBtnByRemark(String remark);

    @CacheEvict(value = "btn:find", allEntries = true)
    int deleteById(Long btnId);
}